#{extends 'CRUD/layout.html' /}
#{set 'moreStyles'}
<link href="@{'/public/javascripts/uploadify/uploadify.css'}" type="text/css" rel="stylesheet" />
#{/set}

#{set 'moreScripts'}
<script src="@{'/public/javascripts/uploadify/jquery.uploadify.v2.1.4.min.js'}" type="text/javascript"></script>
<script src="@{'/public/javascripts/uploadify/swfobject.js'}" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
	var prefix = "${play.configuration['attachments.download.prefix']}";
	$('#imageUpload').uploadify({
			  'uploader'  : "@{'/public/javascripts/uploadify/uploadify.swf'}",
			  'script'    : "@{Files.upload}",
			  'cancelImg' : "@{'/public/javascripts/uploadify/cancel.png'}",
			  'fileDataName' : 'file',
			  'auto'      : true,
			  'multi'     : false, 
			  'fileExt'     : '*.jpg;*.gif;*.png',
			  'fileDesc'    : '选择图片',
			  'onComplete'  : function(event, ID, fileObj, fileName , data) {
			      $("#image").val(fileName);
			      $("#imageLink").attr("src",prefix+fileName);
			      $("#imageLink").attr("width",100);
			    }
			});
});
</script>
#{/set}

#{doLayout/}